import React, { Component } from 'react'
import CourseItem from "./CourseItem";


//! 严格模式
export default class Courselist extends Component {
    state={
        courseData:[
            {name:'Node.js',task:'1',stu:20,id:'001'},
            {name:'移动web',task:0,stu:30,id:'002'},
            {name:'微信开发',task:0,stu:40,id:'003'},
            {name:'测试基础',task:0,stu:50,id:'004'},
            {name:'java开发',task:0,stu:60,id:'005'}
        ]
    }
    render() {
        const {courseData}=this.state;
        return (
            <div style={{display:"flex",justifyContent:'space-between',flexWrap:'wrap'}}>
                {
                    //! 由函数返回值决定map里面每一项返回值 
                    //! 要么写 { return }  要么不写{}写成(),直接返回 
                    courseData.map((item)=>(
                        <CourseItem stu={item.stu} task={item.task} name={item.name} key={item.id}/> 
                    ))
                }
                {/* {
                    courseData.map((item)=>(
                    <CourseItem data={item} key={item.id}/> 
                    ))
                } */}
                {/* 批量传属性 */}
                {/* {
                    courseData.map((item)=>(
                    <CourseItem {...item} key={item.id}/> 
                    ))
                } */}
            </div>
        )
    }
}
